package EmailLogin.JDBC;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JDBC {
    //4大参数
    private static final String USERNAME="root";
    private static final String PASSWORD="123456";
    private static final String URL="jdbc:mysql://localhost:3306/test01";
    private static final String DRIVER="com.mysql.cj.jdbc.Driver";
    //建立连接
    private Connection con;
    //获取连接  
    public Connection getCon(){
        return con;
    }

    public JDBC() throws ClassNotFoundException, SQLException {
        Class.forName(DRIVER);
        con= DriverManager.getConnection(URL,USERNAME,PASSWORD);
    }
}
